package cn.stool.cloud.api;

import cn.stool.cloud.common.Result;
import cn.stool.cloud.service.ProducerService;
import org.apache.rocketmq.client.producer.SendResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: Felix YF Dong
 * @Date : 2024/2/5 17:29
 * @Description:
 **/
@RestController
@RequestMapping("/api")
public class RocketMQApi {

    @Autowired
    private ProducerService producerService;

    @GetMapping("/send")
    public void send() {
        producerService.send("user");
    }

    @GetMapping("/sendTag")
    public Result sendTag() {
        SendResult sendResult = producerService.sendTagMsg("带有tag的字符消息");
        return Result.data(sendResult);
    }
}
